package com.klei.service.impl;

import com.klei.dao.ICityManagerDao;
import com.klei.pojo.CityManager;
import com.klei.service.ICityManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CityManagerServiceImpl implements ICityManagerService {

    @Autowired
    private ICityManagerDao cityManagerDao;

    @Override
    public List<CityManager> getAllCity() {
        return cityManagerDao.getAllCity();
    }

    @Override
    public List<CityManager> getAllCountry() {
        return cityManagerDao.getAllCountry();
    }

    @Override
    public List<CityManager> getAllCityByPage(int page, int limit) {
        return cityManagerDao.getAllCityByPage(page, limit);
    }

    @Override
    public List<CityManager> getAllCountryByPage(int page, int limit) {
        return cityManagerDao.getAllCountryByPage(page, limit);
    }

    @Override
    public int getAllCityCount() {
        return cityManagerDao.getAllCityCount();
    }

    @Override
    public int getAllCountryCount() {
        return cityManagerDao.getAllCountryCount();
    }

    @Override
    public boolean saveCity(String name) {
        return cityManagerDao.saveCity(name) > 0;
    }

    @Override
    public boolean saveCountry(CityManager cityManager) {
        return cityManagerDao.saveCountry(cityManager) > 0;
    }

    @Override
    public boolean updateCity(CityManager cityManager) {
        return cityManagerDao.updateCity(cityManager) > 0;
    }

    @Override
    public boolean deleteCityById(int id) {
        return cityManagerDao.deleteCityById(id) > 0;
    }

}
